#    Copyright 2012 New Mexico EPSCoR
#
#    This file is part of Teacher's P.E.T.
#
#    Teacher's P.E.T. is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Teacher's P.E.T. is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Teacher's P.E.T..  If not, see <http://www.gnu.org/licenses/>.

from django.conf.urls.defaults import *

from views.forum import *
from views.message import *

urlpatterns = patterns('',
        (r'messages/send/draft/(?P<draft_id>\d+?)/attach/',attach_draft,{},'forum_attach_draft'),
        (r'messages/send/draft/(?P<draft_id>\d+?)/',send_pm,{},'forum_edit_draft'),
        (r'messages/send/(?P<reply_to>\d+?)/reply/',send_pm,{'reply_type':'reply'},'forum_reply_to_message'),
        (r'messages/send/(?P<reply_to>\d+?)/forward/',send_pm,{'reply_type':'forward'},'forum_forward_message'),
        (r'messages/send/',send_pm,{},'forum_send_message'),
        (r'messages/blocklist/',view_blocklist,{},'forum_view_blocklist'),
        (r'messages/view/(?P<message_id>\d+?)/',view_message, {}, 'forum_view_message'),
        (r'messages/mark/(?P<message_id>\d+?)/delete/',mark_message, {'option':'delete'}, 'forum_delete_message'),
        (r'messages/mark/(?P<message_id>\d+?)/undelete/',mark_message, {'option':'undelete'}, 'forum_undelete_message'),
        (r'messages/mark/(?P<message_id>\d+?)/unread/',mark_message, {'option':'unread'}, 'forum_unread_message'),
        (r'messages/mark/(?P<message_id>\d+?)/report/',mark_message, {'option':'report'}, 'forum_report_message'),
        (r'messages/block/(?P<message_id>\d+?)/',mark_message, {'option':'block'}, 'forum_block_message_sender'),
        (r'messages/unblock/(?P<message_id>\d+?)/',mark_message, {'option':'unblock'}, 'forum_unblock_message_sender'),
        (r'messages/(?P<message_id>\d+?)/download/(?P<filename>.+)',download_message_attachment, {}, 'forum_download_message_attachment'),
        (r'messages/(?P<message_id>\d+?)/delete/(?P<file_id>\d+?)/',delete_message_attachment, {}, 'forum_delete_message_attachment'),
        (r'messages/(?P<folder>.+?)/(?P<page>\d*?)/',view_messages, {}, 'forum_view_folder_page'),
        (r'messages/(?P<folder>.+?)/',view_messages, {}, 'forum_view_folder'),
        (r'messages/',view_messages, {'folder':'inbox'}, 'forum_view_messages'),
        
        (r'create/',edit_entry, {}, 'forum_create_thread'),
        (r'(?P<thread_id>\d+?)/posts/(?P<entry_number>\d+?)/edit/',edit_entry, {}, 'forum_edit_entry'),
        (r'(?P<thread_id>\d+?)/posts/(?P<page>\d+?)/',view_entries, {}, 'forum_view_entries_page'),
        (r'(?P<thread_id>\d+?)/posts/',view_entries, {}, 'forum_view_entries'),
        (r'(?P<thread_id>\d+?)/create/',edit_entry, {}, 'forum_create_entry'),
        (r'(?P<thread_id>\d+?)/(?P<entry_number>\d+?)/download/(?P<filename>.+)',download_attachment, {}, 'forum_download_attachment'),
        (r'(?P<thread_id>\d+?)/(?P<entry_number>\d+?)/delete/(?P<file_id>\d+?)/',delete_attachment, {}, 'forum_delete_attachment'),
        (r'(?P<thread_id>\d+?)/(?P<quote_entry_number>\d+?)/create/',edit_entry,{},'forum_create_quoted_entry'),
        (r'(?P<thread_id>\d+?)/(?P<entry_number>\d+?)/attach/',attach_entry, {}, 'forum_attach_entry'),
        (r'(?P<thread_id>\d+?)/(?P<entry_number>\d+?)/flag/',flag_entry, {}, 'forum_flag_entry'),
        (r'(?P<thread_id>\d+?)/(?P<entry_number>\d+?)/like/',like_entry, {}, 'forum_like_entry'),
        
        (r'(?P<page>\d+?)/',view_threads, {}, 'forum_view_threads_page'),
        (r'',view_threads, {}, 'forum_view_threads'),

)
